/* $Id: guiGal.h V1.0 2001/10/20 */
/*************************************************************************
 *    This source code has been made available to you by EPSON on an AS-IS
 *    basis.  Anyone receiving this source is licensed under EPSON
 *    copyrights to use it in any way he or she deems fit, including
 *    copying it, modifying it, compiling it, and redistributing it either
 *    with or without modifications.
 *
 *    Any person who transfers this source code or any derivative work
 *    must include the EPSON copyright notice, this paragraph, and the
 *    preceding two paragraphs in the transferred software.
 *
 *    COPYRIGHT   EPSON  CORPORATION 2001
 *    LICENSED MATERIAL  -  PROGRAM PROPERTY OF EPSON
 ***********************************************************************/

/***********************************************************************
 * FILE: guiGal.h
 * MODULE: Graphic abstract layer
 *
 *  PURPOSE:
 * AUTHOR(S): YangCX
 * GROUP: GUI Group
 * DATE CREATED: 2001/10/20
 * REFERENCE DOCUMENT ID:
 * MODIFICATIONS:
 *    Date          userName     Description
 *   2001/10/20     YangCX       Create this file
 **********************************************************************/

#ifndef _GUIGAL_H
#define _GUIGAL_H

#ifdef __cplusplus
extern "C" {
#endif

#define GAL_OK 		0
#define GAL_FAILED  -1

/**********************************************************************************
  Interface to Screen Device Driver
  This structure is also allocated for memory (offscreen) drawing and blitting.
  This structure is used to pass parameters into the low level device
  driver functions.
 *********************************************************************************/

typedef  struct T_GAL_GraphicContext*  T_GAL_pGC;

typedef struct T_GAL_GraphicContext {
	T_WORD	xRes;			/* X screen res (real) */
	T_WORD	yRes;			/* Y screen res (real) */
	T_WORD	xVirtRes;		/* X drawing res (will be flipped in portrait mode) */
	T_WORD	yVirtRes;		/* Y drawing res (will be flipped in portrait mode) */
	T_WORD	planes;			/* # planes */
	T_WORD	bpp;			/* # bits per pixel */
	T_WORD	LineLen;		/* line length in bytes */
	T_WORD	size;			/* size of memory allocated*/
    T_UWORD ForeGround;	   	/* current foreground color */
	T_UWORD BackGround;     /* current background color */
  	T_WORD	DoClip;         /* flag of clipping */
	T_WORD	ClipMinX;		/* minimum x value of cache rectangle */
	T_WORD	ClipMinY;		/* minimum y value of cache rectangle */
	T_WORD	ClipMaxX;		/* maximum x value of cache rectangle */
	T_WORD	ClipMaxY;		/* maximum y value of cache rectangle */
	T_WORD	ncolors;		/* # screen colors */
	T_WORD	flags;			/* device flags */
	T_VOID  *addr;			/* address of memory allocated (memdc or fb) */

	T_GAL_pGC	(*Open)(T_GAL_pGC pGC);
	T_VOID	(*Close)(T_GAL_pGC pGC);

	T_VOID	(*SetPalette)(T_GAL_pGC pGC,T_WORD first, T_WORD count,  T_GUI_COLOR *cmap);
	T_VOID	(*GetPalette)(T_GAL_pGC pGC,T_WORD first, T_WORD count, T_GUI_COLOR *cmap);

	T_GAL_pGC	(*AllocateMemGC)(T_GAL_pGC pGC);

	T_WORD	(*MapMemGC)(
			T_GAL_pGC	MempGC,
			T_WORD	w,
			T_WORD 	h,
			T_WORD 	planes,
			T_WORD 	bpp,
			T_WORD	LineLen,
			T_WORD	size,
			T_VOID 	*addr
			);

	T_VOID	(*FreeMemGC)(T_GAL_pGC MempGC);

	T_WORD	(*ClipPoint)(T_GAL_pGC pGC,T_WORD x,T_WORD y);

	T_VOID	(*FillRect)(
			T_GAL_pGC 	pGC,
			T_WORD 	x,
			T_WORD 	y ,
			T_WORD 	w ,
			T_WORD 	h,
			T_GUI_PIXEL	c
			);

	T_VOID 	 (*DrawPixel)(T_GAL_pGC pGC, T_WORD x, T_WORD y, T_GUI_PIXEL c);
	T_UWORD  (*ReadPixel)(T_GAL_pGC pGC, T_WORD x, T_WORD y);

	T_VOID 	(*DrawHLine)(
			T_GAL_pGC	pgc,
			T_WORD 	x,
			T_WORD 	y,
			T_WORD 	w,
			T_GUI_PIXEL c
			);

	T_VOID	(*PutHLine) (
			T_GAL_pGC 	pGC,
			T_WORD 	x,
			T_WORD 	y,
			T_WORD 	w,
			T_VOID	*buf
			);

	T_VOID	(*GetHLine) (
			T_GAL_pGC 	pGC,
			T_WORD 	x,
			T_WORD 	y,
			T_WORD 	w,
			T_VOID	*buf
			);

	T_VOID 	(*DrawVLine)(
			T_GAL_pGC 	pGC,
			T_WORD 	x,
			T_WORD 	y,
			T_WORD 	h,
			T_GUI_PIXEL c
			);

	T_VOID	(*PutVLine) (
			T_GAL_pGC	pGC,
			T_WORD 	x,
			T_WORD 	y,
			T_WORD 	h,
			T_VOID	* buf
			);

	T_VOID	(*GetVLine) (
			T_GAL_pGC 	pGC,
			T_WORD 	x,
			T_WORD 	y,
			T_WORD 	h,
			T_VOID	*buf
			);

	T_VOID  (*Blit) (
			T_GAL_pGC	DstpGC,
			T_WORD	DstX,
			T_WORD 	DstY,
			T_WORD 	w,
			T_WORD 	h,
			T_GAL_pGC 	Srcpgc,
			T_WORD 	SrcX,
			T_WORD 	SrcY
			);

	T_VOID	(*PutBox)(
			T_GAL_pGC 	pGC,
			T_WORD 	x,
			T_WORD 	y,
			T_WORD 	w,
			T_WORD 	h,
			T_VOID	*buf,
			T_WORD BufLen
			);

	T_VOID	(*GetBox)(
			T_GAL_pGC 	pGC,
			T_WORD 	x,
			T_WORD 	y,
			T_WORD 	w,
			T_WORD 	h,
			T_VOID	*buf,
			T_WORD BufLen
			);

	T_VOID	(*PutBoxMask) (
			T_GAL_pGC 	pGC,
			T_WORD	x,
			T_WORD 	y,
			T_WORD 	w,
			T_WORD 	h,
			T_VOID	*buf,
			T_WORD BufLen,
			T_GUI_PIXEL	cxx
			);

	T_VOID 	(*CopyBox) (
			T_GAL_pGC 	pGC,
			T_WORD 	x1,
			T_WORD 	y1,
			T_WORD	w,
			T_WORD 	h,
			T_WORD 	x2,
			T_WORD 	y2
			);

	T_GUI_PIXEL(*MapColor) (
			T_GAL_pGC pGC,
			T_GUI_COLOR *color
			);	/*added for porting easily 2002.6.12*/

	T_WORD	(*PutImageArea)(
				T_GAL_pGC	pGC,
				T_UWORD		beginx,
				T_UWORD		beginy,
				T_UWORD		w,
				T_UWORD		h,
				T_UBYTE		*buf ,
				T_WORD picx,
				T_WORD picy,
				T_WORD BufLen
				);		// ADDED BY DAVID CHENG
	T_WORD (*PutSubImageArea)(
				T_GAL_pGC pGC,
				T_WORD x,
				T_WORD y,
				T_WORD w,
				T_WORD h,
				T_UBYTE *buf,
				T_WORD delta_x,
				T_WORD delta_y);			
} T_GAL_GraphicContext;

T_EXTERN T_GAL_GraphicContext* tpGAL_PhyGc;
T_EXTERN T_GAL_GraphicContext  tGAL_PhyGc;

/****************************************************************************
* Truecolor color conversion and extraction macros
* Conversion from T_RGB to T_GUI_PIXEL
*****************************************************************************/

/* create 24 bit 8/8/8 format pixel (0x00RRGGBB) from RGB triplet*/
#define GAL_RGB2PIXEL888(r,g,b)	\
	(((r) << 16) | ((g) << 8) | (b))

/* create 16 bit 5/6/5 format pixel from RGB triplet */
#define GAL_RGB2PIXEL565(r,g,b)	\
	((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3))

/* create 16 bit 4/4/4/0 format pixel from RGB triplet */
#define GAL_RGB2PIXEL4440(r,g,b)	\
	((((r) & 0xf0) << 8) | (((g) & 0xf0) << 4) | (((b) & 0xf0) << 0))

/* create 15 bit 5/5/5 format pixel from RGB triplet */
#define GAL_RGB2PIXEL555(r,g,b)	\
	((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3))

/* create 8 bit 3/3/2 format pixel from RGB triplet*/
#define GAL_RGB2PIXEL332(r,g,b)	\
	(((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6))

/*****************************************************************************
* Conversion from COLORVAL to T_GUI_PIXEL
******************************************************************************/

/* create 24 bit 8/8/8 format pixel from RGB colorval (0x00BBGGRR)*/
#define GAL_COLOR2PIXEL888(c)	\
	((((c) & 0xff) << 16) | ((c) & 0xff00) | (((c) & 0xff0000) >> 16))

/* create 16 bit 5/6/5 format pixel from RGB colorval (0x00BBGGRR)*/
#define GAL_COLOR2PIXEL565(c)	\
	((((c) & 0xf8) << 8) | (((c) & 0xfc00) >> 5) | (((c) & 0xf80000) >> 19))

/* create 15 bit 5/5/5 format pixel from RGB colorval (0x00BBGGRR)*/
#define GAL_COLOR2PIXEL555(c)	\
	((((c) & 0xf8) << 7) | (((c) & 0xf800) >> 6) | (((c) & 0xf80000) >> 19))

/* create 8 bit 3/3/2 format pixel from RGB colorval (0x00BBGGRR)*/
#define GAL_COLOR2PIXEL332(c)	\
	(((c) & 0xe0) | (((c) & 0xe000) >> 11) | (((c) & 0xc00000) >> 22))

/******************************************************************************
* Conversion from T_GUI_PIXEL to red, green or blue components
*******************************************************************************/

/* return 8/8/8 bit r, g or b component of 24 bit T_GUI_PIXEL */
#define GAL_PIXEL888RED(gal_pixel)		(((gal_pixel) >> 16) & 0xff)
#define GAL_PIXEL888GREEN(gal_pixel)	(((gal_pixel) >> 8) & 0xff)
#define GAL_PIXEL888BLUE(gal_pixel)		((gal_pixel) & 0xff)

/* return 5/6/5 bit r, g or b component of 16 bit T_GUI_PIXEL */
#define GAL_PIXEL565RED(gal_pixel)		(((gal_pixel) >> 11) & 0x1f)
#define GAL_PIXEL565GREEN(gal_pixel)	(((gal_pixel) >> 5) & 0x3f)
#define GAL_PIXEL565BLUE(gal_pixel)		((gal_pixel) & 0x1f)

/* return 4/4/4/0 bit r, g or b component of 16 bit T_GUI_PIXEL */
#define GAL_PIXEL4440RED(gal_pixel)		(((gal_pixel) >> 12) & 0x0f)
#define GAL_PIXEL4440GREEN(gal_pixel)	(((gal_pixel) >> 8) & 0x0f)
#define GAL_PIXEL4440BLUE(gal_pixel)	(((gal_pixel) >> 4) & 0x0f)

/* return 5/5/5 bit r, g or b component of 16 bit T_GUI_PIXEL */
#define GAL_PIXEL555RED(gal_pixel)		(((gal_pixel) >> 10) & 0x1f)
#define GAL_PIXEL555GREEN(gal_pixel)	(((gal_pixel) >> 5) & 0x1f)
#define GAL_PIXEL555BLUE(gal_pixel)		((gal_pixel) & 0x1f)

/* return 3/3/2 bit r, g or b component of 8 bit T_GUI_PIXEL */
#define GAL_PIXEL332RED(gal_pixel)		(((gal_pixel) >> 5) & 0x07)
#define GAL_PIXEL332GREEN(gal_pixel)	(((gal_pixel) >> 2) & 0x07)
#define GAL_PIXEL332BLUE(gal_pixel)		((gal_pixel) & 0x03)

/* PGC flags */
#define	GAL_PSF_SCREEN			0x0001	/* screen device*/
#define GAL_PSF_MEMORY			0x0002	/* memory device*/
#define GAL_PSF_HAVEBLIT		0x0004	/* have bitblit*/
#define GAL_PSF_PORTRAIT		0x0008	/* in portrait mode*/
#define GAL_PSF_HAVEOP_COPY		0x0010	/* pGC->DrawArea can do area copy*/
#define GAL_PSF_ADDRMALLOC		0x0020	/* pGC->addr was malloc'd*/
#define GAL_PSF_ADDRSHAREDMEM	0x0040	/* pGC->addr is shared memory*/

#define GAL_CLIP_VISIBLE 	1
#define GAL_CLIP_INVISIBLE	0
#define GAL_CLIP_PARTIAL	-1


/***********************************************************************
		Graphic abstract layer
***********************************************************************/

T_EXTERN T_GUI_PIXEL taGDI_SysPixelIndex [];
T_EXTERN T_CONST T_GUI_Rgb taGDI_SysPixelColor [];

typedef struct T_GAL_Output
{
    /* Physical graphics context */
    T_GAL_pGC   phy_pgc;
    T_WORD  bytes_per_phypixel;
    T_WORD  bits_per_phypixel;
    T_WORD  width_phygc;
    T_WORD  height_phygc;
    T_WORD  colors_phygc;
    T_BOOL  grayscale_screen;

    /* GC properties */
    T_WORD     (*BytesPerPixel) (T_GAL_pGC pGC);
    T_WORD     (*BitsPerPixel) (T_GAL_pGC pGC);
    T_WORD     (*width) (T_GAL_pGC pGC);
    T_WORD     (*height) (T_GAL_pGC pGC);
    T_WORD     (*colors) (T_GAL_pGC pGC);

    /* Allocation and release of graphics context */
    T_WORD     (*AllocateGc) (
				T_GAL_pGC pGC,
				T_WORD width,
				T_WORD height,
				T_WORD depth,
                T_GAL_pGC  *NewpGC
                );
    T_VOID     (*FreeGc) (T_GAL_pGC pGC);
    T_VOID     (*SetGc) (T_GAL_pGC pGC);

    /* Clipping of graphics context */
    T_VOID     (*EnableClipping) (T_GAL_pGC pGC);
    T_VOID     (*DisableClipping) (T_GAL_pGC pGC);
    T_WORD     (*SetClipping) (T_GAL_pGC pGC, T_WORD x1, T_WORD y1, T_WORD x2, T_WORD y2);
    T_WORD     (*GetClipping) (
		        T_GAL_pGC pGC,
		        T_WORD* x1,
		        T_WORD* y1,
		        T_WORD* x2,
		        T_WORD* y2
		        );

    /* Background and foreground colors */
    T_WORD     (*GetBgColor) (T_GAL_pGC pGC, T_GUI_PIXEL* color);
    T_WORD     (*SetBgColor) (T_GAL_pGC pGC, T_GUI_PIXEL color);
    T_WORD     (*GetFgColor) (T_GAL_pGC pGC, T_GUI_PIXEL* color);
    T_WORD     (*SetFgColor) (T_GAL_pGC pGC, T_GUI_PIXEL color);

    /* Convertion between T_GUI_COLOR and T_GUI_PIXEL */
    T_GUI_PIXEL(*MapColor) (T_GAL_pGC pGC, T_GUI_COLOR *color);
    T_WORD     (*UnmapPixel) (T_GAL_pGC pGC, T_GUI_PIXEL pixel, T_GUI_COLOR* color);
    T_WORD     (*PackColors) (T_GAL_pGC pGC, T_VOID* buf, T_GUI_COLOR* colors, T_WORD len);
    T_WORD     (*UnpackPixels) (
		        T_GAL_pGC pGC,
		        T_VOID* buf,
		        T_GUI_COLOR* colors,
		        T_WORD len
		        );

    /* Palette operations */
    T_WORD     (*GetPalette) (T_GAL_pGC pGC, T_WORD s, T_WORD len, T_GUI_COLOR* cmap);
    T_WORD     (*SetPalette) (T_GAL_pGC pGC, T_WORD s, T_WORD len, T_GUI_COLOR* cmap);
    T_WORD     (*SetColorFulPalette) (T_GAL_pGC pGC);

    /* Box operations */
    T_GUI_SIZE (*BoxSize) (T_GAL_pGC pGC, T_WORD w, T_WORD h);
    T_WORD     (*FillBox) (
		        T_GAL_pGC pGC,
		        T_WORD x,
		        T_WORD y,
		        T_WORD w,
		        T_WORD h,
                T_GUI_PIXEL pixel
                );
    T_WORD     (*PutBox) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD w, T_WORD h, T_VOID* buf);
    T_WORD     (*GetBox) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD w, T_WORD h, T_VOID* buf);
    T_WORD     (*PutBoxMask) (
		        T_GAL_pGC pGC,
		        T_WORD x,
		        T_WORD y,
		        T_WORD w,
		        T_WORD h,
		        T_VOID* buf,
		        T_GUI_PIXEL cxx
		        );

    T_WORD     (*ScaleBox) (
				T_GAL_pGC pGC,
				T_WORD sw,
				T_WORD sh,
				T_VOID* srcbuf,
                T_WORD dw,
                T_WORD dh,
                T_VOID* dstbuf
                );

    T_WORD     (*CopyBox) (
		        T_GAL_pGC pGC,
		        T_WORD x,
		        T_WORD y,
		        T_WORD w,
		        T_WORD h,
		        T_WORD nx,
		        T_WORD ny
		        );

    T_WORD     (*CrossBlit) (
		        T_GAL_pGC src,
		        T_WORD sx,
		        T_WORD sy,
		        T_WORD sw,
		        T_WORD sh,
                T_GAL_pGC dst,
                T_WORD dx,
                T_WORD dy
                );

    /* Horizontal line operaions */
    T_WORD     (*DrawHLine) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD w, T_GUI_PIXEL pixel);
    T_WORD     (*PutHLine)  (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD w, T_VOID* buf);
    T_WORD     (*GetHLine)  (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD w, T_VOID* buf);

    /* Vertical line operations */
    T_WORD     (*DrawVLine) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD h, T_GUI_PIXEL pixel);
    T_WORD     (*PutVLine)  (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD h, T_VOID* buf);
    T_WORD     (*GetVLine)  (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD h, T_VOID* buf);

    /* Pixel operations */
    T_WORD     (*DrawPixel) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_GUI_PIXEL pixel);
    T_WORD     (*GetPixel) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_GUI_PIXEL* color);

    /* Other drawing */
    T_WORD     (*circle) (T_GAL_pGC pGC, T_WORD x, T_WORD y, T_WORD r, T_GUI_PIXEL pixel);
    T_WORD     (*line) (
		        T_GAL_pGC pGC,
		        T_WORD x1,
		        T_WORD y1,
		        T_WORD x2,
		        T_WORD y2,
                T_GUI_PIXEL pixel
                );

    T_WORD     (*rectangle) (
		        T_GAL_pGC pGC,
		        T_WORD l,
		        T_WORD t,
		        T_WORD r,
		        T_WORD b,
                T_GUI_PIXEL pixel
                );
/*************************************************************************
*		Horse done!
*		Ellipse,Arc
**************************************************************************/

    T_WORD     (*ellipse) (
	   			T_GAL_pGC 	pGC,
	   			T_WORD 	x,
	   			T_WORD 	y,
	   			T_WORD 	rx,
	   			T_WORD 	ry,
	   			T_GUI_PIXEL pixel
 	   		);
    T_WORD     (*ellipsearc) (
	   			T_GAL_pGC 	pGC,
	   			T_WORD 	x,
	   			T_WORD 	y,
	   			T_WORD 	rx,
	   			T_WORD 	ry,
				T_WORD	startX,
				T_WORD	startY,
				T_WORD	endX,
				T_WORD	endY,
	   			T_GUI_PIXEL pixel
 	   		);
    T_WORD     (*fillellipsearc) (
	   			T_GAL_pGC 	pGC,
	   			T_WORD 	x,
	   			T_WORD 	y,
	   			T_WORD 	rx,
	   			T_WORD 	ry,
				T_WORD	startX,
				T_WORD	startY,
				T_WORD	endX,
				T_WORD	endY,
	   			T_GUI_PIXEL pixel
 	   		);
#if 0
    T_WORD     (*arc) (
	   			T_GAL_pGC 	pGC,
	   			T_WORD 	x,
	   			T_WORD 	y,
	   			T_DWORD ang1,
	   			T_DWORD ang2,
	   			T_WORD r,
	   			T_GUI_PIXEL pixel
 	   		);
#else
    T_WORD     (*arc) (
	   			T_GAL_pGC 	pGC,
	   			T_WORD 	x,
	   			T_WORD 	y,
	   			T_WORD ang1,
	   			T_WORD ang2,
	   			T_WORD r,
	   			T_GUI_PIXEL pixel
 	   		);
#endif
	T_WORD (*PutImageArea)(
				T_GAL_pGC pGC,
				T_WORD x,
				T_WORD y,
				T_WORD w,
				T_WORD h,
				T_UBYTE *buf );
	T_WORD (*PutSubImageArea)(
				T_GAL_pGC pGC,
				T_WORD x,
				T_WORD y,
				T_WORD w,
				T_WORD h,
				T_UBYTE *buf, 
				T_WORD delta_x,
				T_WORD delta_y);
}T_GAL_Output;

T_EXTERN T_GAL_Output* tpGAL_Output;

/* API for Graphic operation */
#define pGAL_PhyPgc               (tpGAL_Output->phy_pgc)
#define wGAL_BytesPerPhyPixel     (tpGAL_Output->bytes_per_phypixel)
#define wGAL_BitsPerPhyPixel      (tpGAL_Output->bits_per_phypixel)
#define wGAL_WidthPhyGc           (tpGAL_Output->width_phygc)
#define wGAL_HeightPhyGc          (tpGAL_Output->height_phygc)
#define wGAL_ColorsPhyGc          (tpGAL_Output->colors_phygc)
#define oGAL_GrayscaleScreen      (tpGAL_Output->grayscale_screen)

#define fnGAL_BytesPerPixel       (*tpGAL_Output->BytesPerPixel)
#define fnGAL_BitsPerPixel        (*tpGAL_Output->BitsPerPixel)
#define fnGAL_Width               (*tpGAL_Output->width)
#define fnGAL_Height              (*tpGAL_Output->height)
#define fnGAL_Colors              (*tpGAL_Output->colors)

#define fnGAL_AllocateGC          (*tpGAL_Output->AllocateGc)
#define fnGAL_FreeGC              (*tpGAL_Output->FreeGc)

#define fnGAL_SetGC(pgc)           \
		if (tpGAL_Output->SetGc) (*tpGAL_Output->SetGc) (pgc)

#define fnGAL_EnableClipping      (*tpGAL_Output->EnableClipping)
#define fnGAL_DisableClipping     (*tpGAL_Output->DisableClipping)
#define fnGAL_SetClipping         (*tpGAL_Output->SetClipping)
#define fnGAL_GetClipping         (*tpGAL_Output->GetClipping)

#define fnGAL_GetBgColor          (*tpGAL_Output->GetBgColor)
#define fnGAL_GetFgColor          (*tpGAL_Output->GetFgColor)
#define fnGAL_SetBgColor(pgc, pixel)   \
		if (tpGAL_Output->SetBgColor) (*tpGAL_Output->SetBgColor) (pgc, pixel)
#define fnGAL_SetFgColor(pgc, pixel)   \
		if (tpGAL_Output->SetFgColor) (*tpGAL_Output->SetFgColor) (pgc, pixel)

#define fnGAL_MapColor            (*tpGAL_Output->MapColor)
#define fnGAL_UnmapPixel          (*tpGAL_Output->UnmapPixel)
#define fnGAL_PackColors          (*tpGAL_Output->PackColors)
#define fnGAL_UnpackPixels        (*tpGAL_Output->UnpackPixels)

#define fnGAL_GetPalette          (*tpGAL_Output->GetPalette)
#define fnGAL_SetPalette          (*tpGAL_Output->SetPalette)
#define fnGAL_SetColorfulePalette (*tpGAL_Output->SetColorFulPalette)

#define fnGAL_BoxSize             (*tpGAL_Output->BoxSize)
#define fnGAL_FillBox             (*tpGAL_Output->FillBox)
#define fnGAL_PutBox              (*tpGAL_Output->PutBox)
#define fnGAL_GetBox              (*tpGAL_Output->GetBox)
#define fnGAL_PutBoxMask          (*tpGAL_Output->PutBoxMask)
#define fnGAL_ScaleBox            (*tpGAL_Output->ScaleBox)

#define fnGAL_CopyBox             (*tpGAL_Output->CopyBox)
#define fnGAL_CrossBlit           (*tpGAL_Output->CrossBlit)

#define fnGAL_DrawHLine           (*tpGAL_Output->DrawHLine)
#define fnGAL_PutHLine            (*tpGAL_Output->PutHLine)
#define fnGAL_GetHLine            (*tpGAL_Output->GetHLine)

#define fnGAL_DrawVLine           (*tpGAL_Output->DrawVLine)
#define fnGAL_PutVLine            (*tpGAL_Output->PutVLine)
#define fnGAL_GetVLine            (*tpGAL_Output->GetVLine)

#define fnGAL_DrawPixel           (*tpGAL_Output->DrawPixel)
#define fnGAL_GetPixel            (*tpGAL_Output->GetPixel)

#define fnGAL_Circle              (*tpGAL_Output->circle)
#define fnGAL_Line                (*tpGAL_Output->line)
#define fnGAL_Rectangle           (*tpGAL_Output->rectangle)
/*************************************************************************
*		Horse done!
*		Ellipse,Arc
**************************************************************************/
#define fnGAL_Ellipse				(*tpGAL_Output->ellipse)
#define fnGAL_EllipseArc			(*tpGAL_Output->ellipsearc)
#define fnGAL_FillEllipseArc		(*tpGAL_Output->fillellipsearc)
#define fnGAL_Arc					(*tpGAL_Output->arc)

#define fnGAL_PutImageArea			(*tpGAL_Output->PutImageArea)
#define fnGAL_PutSubImageArea		(*tpGAL_Output->PutSubImageArea)


T_WORD fnGAL_InitOutput(T_VOID);


#ifdef __cplusplus
}
#endif

#endif  /* _GUIGAL_H */
